package com.stox.client.ui.javafx.chartingy.model.node;

import com.stox.client.ui.javafx.chartingy.model.plot.Data;
import com.stox.shared.core.model.Bar;
import com.stox.shared.core.model.Scrip;

public abstract class AbstractPriceNode extends DataNode<Scrip, Bar> {
	public final Boolean up;

	public AbstractPriceNode(final Data<Scrip, Bar> data) {
		super(data);
		if (getData().getPlot().isPrimary()) {
			final Bar bar = data.getExtraValue();
			final int size = data.getPlot().getData().size();
			if (data.getIndex() < (size - 1)) {
				final Bar previousBar = data.getPlot().getData().get(data.getIndex() + 1).getExtraValue();
				up = previousBar.getClose() < bar.getClose();
			}else{
				up = null;
			}
		} else {
			up = null;
		}
	}
}
